package io.renren.modules.app.controller;

import io.renren.modules.app.service.H5payService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 不动产支付系统接口
 *
 * @author Shark
 * @email shark@126.com
 * @date 2019-08-16 10:49:56
 */
@Slf4j
@Api(tags = "不动产支付系统回调接口")
@RestController
@RequestMapping("/api-app/api/h5pay")
public class NotifyController {
    @Autowired
    private H5payService h5payService;

    /***
     * 1.2银行缴费回调接口
     * @param request
     * @param response
     */
    @ApiOperation("1.2银行缴费回调接口")
    @RequestMapping("/notify")
    public void notify(HttpServletRequest request, HttpServletResponse response) {
        try {
            String resXml = h5payService.notify(request, response);
            PrintWriter out = response.getWriter();
            out.write(resXml);
        } catch (IOException e) {
            log.error(e.getMessage());
        }
    }
}
